/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.anhanguera.tcc.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "tb_contratada_pj")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ContratadaPj.findAll", query = "SELECT c FROM ContratadaPj c"),
    @NamedQuery(name = "ContratadaPj.findByIdContratadaPj", query = "SELECT c FROM ContratadaPj c WHERE c.idContratadaPj = :idContratadaPj"),
    @NamedQuery(name = "ContratadaPj.findByCdCnpjContratadaPj", query = "SELECT c FROM ContratadaPj c WHERE c.cdCnpjContratadaPj = :cdCnpjContratadaPj"),
    @NamedQuery(name = "ContratadaPj.findByNmRazaoSocial", query = "SELECT c FROM ContratadaPj c WHERE c.nmRazaoSocial = :nmRazaoSocial"),
    @NamedQuery(name = "ContratadaPj.findByEdContratada", query = "SELECT c FROM ContratadaPj c WHERE c.edContratada = :edContratada"),
    @NamedQuery(name = "ContratadaPj.findByNmCidade", query = "SELECT c FROM ContratadaPj c WHERE c.nmCidade = :nmCidade"),
    @NamedQuery(name = "ContratadaPj.findBySgUf", query = "SELECT c FROM ContratadaPj c WHERE c.sgUf = :sgUf"),
    @NamedQuery(name = "ContratadaPj.findByCdCep", query = "SELECT c FROM ContratadaPj c WHERE c.cdCep = :cdCep"),
    @NamedQuery(name = "ContratadaPj.findByNuTelefone", query = "SELECT c FROM ContratadaPj c WHERE c.nuTelefone = :nuTelefone"),
    @NamedQuery(name = "ContratadaPj.findByNuFax", query = "SELECT c FROM ContratadaPj c WHERE c.nuFax = :nuFax"),
    @NamedQuery(name = "ContratadaPj.findByNmEmail", query = "SELECT c FROM ContratadaPj c WHERE c.nmEmail = :nmEmail")})
public class ContratadaPj implements Serializable {

    @JoinTable(name = "tb_parte_contratada", joinColumns = {
        @JoinColumn(name = "COD_CONTRATADA_PJ", referencedColumnName = "ID_CONTRATADA_PJ")}, inverseJoinColumns = {
        @JoinColumn(name = "COD_CONTRATO", referencedColumnName = "ID_CONTRATO")})
    @ManyToMany
    private List<Contrato> contratoList;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CONTRATADA_PJ")
    private Integer idContratadaPj;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 14)
    @Column(name = "CD_CNPJ_CONTRATADA_PJ")
    private String cdCnpjContratadaPj;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "NM_RAZAO_SOCIAL")
    private String nmRazaoSocial;
    @Size(max = 100)
    @Column(name = "ED_CONTRATADA")
    private String edContratada;
    @Size(max = 100)
    @Column(name = "NM_CIDADE")
    private String nmCidade;
    @Size(max = 2)
    @Column(name = "SG_UF")
    private String sgUf;
    @Size(max = 9)
    @Column(name = "CD_CEP")
    private String cdCep;
    @Size(max = 50)
    @Column(name = "NU_TELEFONE")
    private String nuTelefone;
    @Size(max = 50)
    @Column(name = "NU_FAX")
    private String nuFax;
    @Size(max = 100)
    @Column(name = "NM_EMAIL")
    private String nmEmail;

    public ContratadaPj() {
    }

    public ContratadaPj(Integer idContratadaPj) {
        this.idContratadaPj = idContratadaPj;
    }

    public ContratadaPj(Integer idContratadaPj, String cdCnpjContratadaPj, String nmRazaoSocial) {
        this.idContratadaPj = idContratadaPj;
        this.cdCnpjContratadaPj = cdCnpjContratadaPj;
        this.nmRazaoSocial = nmRazaoSocial;
    }

    public Integer getIdContratadaPj() {
        return idContratadaPj;
    }

    public void setIdContratadaPj(Integer idContratadaPj) {
        this.idContratadaPj = idContratadaPj;
    }

    public String getCdCnpjContratadaPj() {
        return cdCnpjContratadaPj;
    }

    public void setCdCnpjContratadaPj(String cdCnpjContratadaPj) {
        this.cdCnpjContratadaPj = cdCnpjContratadaPj;
    }

    public String getNmRazaoSocial() {
        return nmRazaoSocial;
    }

    public void setNmRazaoSocial(String nmRazaoSocial) {
        this.nmRazaoSocial = nmRazaoSocial;
    }

    public String getEdContratada() {
        return edContratada;
    }

    public void setEdContratada(String edContratada) {
        this.edContratada = edContratada;
    }

    public String getNmCidade() {
        return nmCidade;
    }

    public void setNmCidade(String nmCidade) {
        this.nmCidade = nmCidade;
    }

    public String getSgUf() {
        return sgUf;
    }

    public void setSgUf(String sgUf) {
        this.sgUf = sgUf;
    }

    public String getCdCep() {
        return cdCep;
    }

    public void setCdCep(String cdCep) {
        this.cdCep = cdCep;
    }

    public String getNuTelefone() {
        return nuTelefone;
    }

    public void setNuTelefone(String nuTelefone) {
        this.nuTelefone = nuTelefone;
    }

    public String getNuFax() {
        return nuFax;
    }

    public void setNuFax(String nuFax) {
        this.nuFax = nuFax;
    }

    public String getNmEmail() {
        return nmEmail;
    }

    public void setNmEmail(String nmEmail) {
        this.nmEmail = nmEmail;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idContratadaPj != null ? idContratadaPj.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContratadaPj)) {
            return false;
        }
        ContratadaPj other = (ContratadaPj) object;
        if ((this.idContratadaPj == null && other.idContratadaPj != null) || (this.idContratadaPj != null && !this.idContratadaPj.equals(other.idContratadaPj))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.anhanguera.tcc.model.ContratadaPj[ idContratadaPj=" + idContratadaPj + " ]";
    }

    @XmlTransient
    public List<Contrato> getContratoList() {
        return contratoList;
    }

    public void setContratoList(List<Contrato> contratoList) {
        this.contratoList = contratoList;
    }

}
